<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">

    <div class="layui-card-body">

        <div class="layui-form-item">
            <label class="layui-form-label">上级</label>
            <div class="layui-input-block">
                <select name='pid' required class='layui-select full-width' id="game111" lay-filter="game111" lay-ignore>
                    <!--{foreach $game as $v}-->
                    <!--{eq name='v.id' value='$vo.pid|default=0'}-->
                    <option selected value='{$v.id}'>{$v.spl|raw}{$v.name}</option>
                    <!--{else}-->
                    <option value='{$v.id}'>{$v.spl|raw}{$v.name}</option>
                    <!--{/eq}-->
                    <!--{/foreach}-->
                </select>
                <!--<p class="help-block"><b>必选</b>，请选择上级菜单或顶级菜单（目前最多支持三级菜单）</p>-->
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">游戏名称/段位</label>
            <div class="layui-input-block">
                <input name="name" value='{$vo.name|default=""}' required placeholder="请输入游戏名称/段位" class="layui-input">
                <!--<p class="help-block"><b>必填</b>建议字符不要太长，一般4-6个汉字</p>-->
            </div>
        </div>

        <div class="layui-form-item" id="hot_value">
            <label class="layui-form-label">热点值</label>
            <div class="layui-input-block">
                <input name="hot_value" value='{$vo.hot_value|default=""}'   placeholder="请输入热点值" class="layui-input">
            </div>
        </div>


    </div>

    <div class="hr-line-dashed"></div>

    <div class="layui-form-item text-center">
        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

</form>

{block name='script'}
<script>
    form.render();
    var ddd = $("#game111 option:selected").val();
    if (ddd == 0){

        $('#hot_value').hide();
    }else{

        $('#hot_value').show();
    }
    $('#game111').change(function () {

        if ($(this).val() == 0){

            $('#hot_value').hide();
        }else{

            $('#hot_value').show();
        }
    });
    require(['jquery.autocompleter'], function () {
        $('[name="icon"]').on('change', function () {
            $(this).parent().next().find('i').get(0).className = this.value
        });
        $('input[name=url]').autocompleter({
            limit: 6, highlightMatches: true, template: '{{ label }} <span> {{ title }} </span>', source: (function (subjects, data) {
                for (var i in subjects) data.push({value: subjects[i].node, label: subjects[i].node, title: subjects[i].title});
                return data;
            })(JSON.parse('{$nodes|raw|json_encode}'), [])
        });

    });


</script>
{/block}
